package 单例模式;

/**
 * @program: leetcode
 * @description: 静态内部类的方法
 * @author: HuRan QQ1345122890
 * @create: 2022-02-07 10:56
 */
public class Mgr06 {
    private static Mgr06 INSTANCE;

    private Mgr06() {
    }

    private static class Mgr06Holder {
        private final static Mgr06 INSTANCE = new Mgr06();
    }

    public static Mgr06 getInstance() {

        return Mgr06Holder.INSTANCE;
    }

    public void m() {
        System.out.println("m");
    }

    public static void main(String[] args) {
        for (int i = 0; i < 100; i++) {
            new Thread(() -> {
                System.out.println(Mgr06.getInstance().hashCode());
            }).start();
        }
    }
}